import * as types from './mutation-types'
// import { saveSessionAppKey, saveSearch, clearSearch, deleteSearch } from 'assets/js/cache'

// 设置sessionAppKey
export const setSessionAppKey = ({commit}, sessionAppKey) => {
  // commit(types.SET_SESSION_APP_KEY, saveSessionAppKey(sessionAppKey))
}

// 注销操作，将用户信息相关全部清空，前期简单写一下
export const logOut = ({commit}, sessionAppKey) => {
  commit(types.SET_SESSION_APP_KEY, '')
  commit(types.SET_MOBILE, '')
  commit(types.SET_AVATAR, '')
  commit(types.SET_REAL_NAME_INFO, {})
  commit(types.SET_ADDRESS, {})
  commit(types.SET_CART_NUM, {})
  commit(types.SET_XFB_INFO, {})
  commit(types.SET_IS_NEW_COUPON, false)
  commit(types.SET_IS_NEW_MESSAGE, false)
}

export const saveSearchHistory = function ({commit}, query) {
  // commit(types.SET_SEARCH_HISTORY, saveSearch(query))
}

export const deleteSearchHistory = function ({commit}, query) {
  // commit(types.SET_SEARCH_HISTORY, deleteSearch(query))
}

export const clearSearchHistory = function ({commit}) {
  // commit(types.SET_SEARCH_HISTORY, clearSearch())
}
